

import com.sun.btrace.annotations.BTrace;
import com.sun.btrace.annotations.Kind;
import com.sun.btrace.annotations.Location;
import com.sun.btrace.annotations.OnMethod;
import com.sun.btrace.AnyType;

@BTrace
public class BTraceScript {
	@OnMethod(clazz = "algorithms.QuickSort", method = "sort")
	public static void sortQuickSortEntry(AnyType[] args) {
		System.out.println("algorithms:QuickSort:sort:" + args[1] + ";"
				+ args[2] + ":method_entr:");
	}

	@OnMethod(clazz = "algorithms.QuickSort", method = "sort", location = @Location(value = Kind.RETURN))
	public static void sortQuickSortExit(AnyType[] args) {
		System.out.println("algorithms:QuickSort:sort:" + args[1] + ";"
				+ args[2] + ":method_exit:");
	}

	@OnMethod(clazz = "algorithms.BubbleSort", method = "sort")
	public static void sortBubbleSortEntry(AnyType[] args) {
		System.out.println("algorithms:BubbleSort:sort:" + args[1] + ";"
				+ args[2] + ":method_entr:");
	}

	@OnMethod(clazz = "algorithms.BubbleSort", method = "sort", location = @Location(value = Kind.RETURN))
	public static void sortBubbleSortExit(AnyType[] args) {
		System.out.println("algorithms:BubbleSort:sort:" + args[1] + ";"
				+ args[2] + ":method_exit:");
	}

	@OnMethod(clazz = "algorithms.HeapSort", method = "sort")
	public static void sortHeapSortEntry(AnyType[] args) {
		System.out.println("algorithms:HeapSort:sort:" + args[1] + ";"
				+ args[2] + ":method_entr:");
	}

	@OnMethod(clazz = "algorithms.HeapSort", method = "sort", location = @Location(value = Kind.RETURN))
	public static void sortHeapSortExit(AnyType[] args) {
		System.out.println("algorithms:HeapSort:sort:" + args[1] + ";"
				+ args[2] + ":method_exit:");
	}

}